package com.mark.service.impl;

import com.mark.entity.school.UGradeSubjectRelation;
import com.mark.mapper.UGradeSubjectRelationMapper;
import com.mark.service.UGradeSubjectRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

/**
 * (UGradeSubjectRelation)表服务实现类
 *
 * @author Deng PengFei
 * @since 2021-10-27 11:17:10
 */
@Service
public class UGradeSubjectRelationServiceImpl implements UGradeSubjectRelationService {
    @Autowired
    private UGradeSubjectRelationMapper uGradeSubjectRelationMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param relId 主键
     * @return 实例对象
     */
    @Override
    public UGradeSubjectRelation queryById(Object relId) {
        return this.uGradeSubjectRelationMapper.queryById(relId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<UGradeSubjectRelation> queryAllByLimit(int offset, int limit) {
        return this.uGradeSubjectRelationMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param uGradeSubjectRelation 实例对象
     * @return 实例对象
     */
    @Override
    public UGradeSubjectRelation insert(UGradeSubjectRelation uGradeSubjectRelation) {
        this.uGradeSubjectRelationMapper.insert(uGradeSubjectRelation);
        return uGradeSubjectRelation;
    }

    /**
     * 修改数据
     *
     * @param uGradeSubjectRelation 实例对象
     * @return 实例对象
     */
    @Override
    public UGradeSubjectRelation update(UGradeSubjectRelation uGradeSubjectRelation) {
        this.uGradeSubjectRelationMapper.update(uGradeSubjectRelation);
        return this.queryById(uGradeSubjectRelation.getRelId());
    }

    /**
     * 通过主键删除数据
     *
     * @param relId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Object relId) {
        return this.uGradeSubjectRelationMapper.deleteById(relId) > 0;
    }
}